<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"
	dir="ltr">
	<head>

		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<c:url value="/css/shopadmin.css"/>"
			type="text/css" />
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/ckeditor.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/ckeditor/adapters/jquery.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.validate.js'/>"></script>
	</head>
	<body style="">
		<div class="head_content" id="headBar" style=""></div>
		<div class="main_content" id="main">
			<form method="post" action="page_article_save.html" id="brandForm">
				<input type="hidden" value="${systemArticles.articleId}"
					name="systemArticles.articleId" />

				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									标题
								</th>
								<td>
									<input type="text" value="${systemArticles.articleTitle}"
										style="width: 120px;" name="systemArticles.articleTitle" class="x-input " />
								</td>
							</tr>
							<tr>
								<th>
									栏目
								</th>
								<td>
									<select id="articleCatId" name="systemArticles.articleCatId"  style="width: 100px;">
											<c:forEach var="cat" items="${systemArticleCats}"   >											
											<option value="${cat.catId}">
												${cat.catName}
											</option>
											 </c:forEach>
										</select>
								</td>
							</tr>
							<tr>
									<th>
										发布：
									</th>
									<td>
										<select id="article_show_on" name="systemArticles.showOn"  style="width: 100px;">
											<option value="1">
												是
											</option>
											<option value="0">
												否
											</option>
										</select>
									</td>
								</tr>
						</tbody>
					</table>
				</div>
				<div class="division">
					<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tbody>
							<tr>
								<th>
									内容
								</th>
								<td>
									<textarea class="jquery_ckeditor" cols="80" id="editor1"
										name="systemArticles.articleContent" rows="10">
							${systemArticles.articleContent}
							</textarea>
								</td>
							</tr>

						</tbody>
					</table>
				</div>


				<div class="table-action">
					<button class="btn" type="submit">
						<span><span><fmt:message key="button.save" /> </span> </span>
					</button>
				</div>
			</form>
		</div>
		<div class="foot_content" id="footBar" style="font-size: 0px;"></div>


		<script type="text/javascript">	
	var config = {
		toolbar:
		[
			[ 'Bold', 'Italic', 'Underline', 'StrikeThrough', '-',
							'Subscript', 'Superscript' ],
					[ 'OrderedList', 'UnorderedList', '-', 'Outdent', 'Indent',
							'Blockquote' ],
					[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
							'JustifyFull' ],
					[ 'Link', 'Unlink', 'Anchor' ],
					[ 'Style', 'FontFormat', 'FontName', 'FontSize' ],
					[ 'Image', 'Flash', 'Table', 'Rule', 'Smiley',
							'SpecialChar' ], [ 'TextColor', 'BGColor','Source' ]
		],
		filebrowserImageUploadUrl : '<c:url value="/uploadFile.html?Type=Image"/>' 
	};
	$('.jquery_ckeditor').ckeditor(config);      
	
	 <c:if test="${not empty systemArticle.articleId}">
 	$('#articleCatId').attr('value','${systemArticle.articleCatId}');
 	$('#article_show_on').attr('value','${systemArticle.showOn}');
 </c:if>
 	

$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#brandForm").validate({
		errorElement: "div" ,
		errorClass: "x-vali-error",
		onfocusout: false,
		rules: {
			'systemArticles.articleTitle' : "required" 
		},
		messages: {
			'systemArticles.articleTitle': "必填字段" 
		},
		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			element.removeClass('x-vali-error');
			error.appendTo( element.parent());
			
			
		},
 
		success: function(div) {	 
			$(div).remove();
		}
	});
});




</script>
	</body>
</html>